function setupLevel() {
	addTimer(canvasWidth / 2 - 80, 20);
}

// ramp: xylh
// rect: ltrb

function createLevel1() {
    setupLevel();
	titleSound.stop();
// sets up the player
    addHint("Use A and D to move! Use W to jump!", 250, 350);
    addPlayer(makeCircle(20, 500, 20));

    var firstRec = makeRect(0, 550, 300, 800, 0);
    //firstRec.glObject.shader = textureShaderProgram;
	addStatic(firstRec);
	//addStatic(makeRect(0, 550, 300, 800, 0));

    // ending platform
    addTrigger(modEndLevel(makeRectX(480, 520, 80, 10, 3)),endLevel);
	addStatic(makeRectX(470, 530, 100, 20, 0));
    
    //addStatic(ParabolaRamp(400, 550, 200, 80));

    // use this to make bounds of the world
    createBounds(canvasWidth, canvasHeight);
}

function createLevel2() {
    setupLevel();
	// sets up the player
	
    addHint("Hold B to boost!", 400, 400);
    addPlayer(makeCircle(20, 500, 20));
	
	addStatic(makeRect(0, 550, 400, 800, 0));

    // ending platform
    addTrigger(modEndLevel(makeRect(630,450, 710, 460, 3)),endLevel);
	addStatic(makeRect(620, 460, 720, 480, 0));
    
	
    addStatic(ParabolaRamp(200, 550, 200, 80));

    // use this to make bounds of the world
    createBounds(canvasWidth, canvasHeight);
}

function createLevel3() {
    setupLevel();

	// sets up the player
    addPlayer(makeCircle(20, 500, 20));
	
	addStatic(makeRect(0, 550, 400, 800, 0));

	addStatic(makeRect(550, 500, 990, 550,0));
	
	addStatic(makeRect(680, 420, 840, 440,0));

    // ending platform
    addTrigger(modEndLevel(makeRectX(880, 340, 80, 10, 3)),endLevel);
	addStatic(makeRectX(870, 350, 100, 20, 0));
	
    addStatic(ParabolaRamp(200, 550, 200, 80));

    // use this to make bounds of the world
    createBounds(canvasWidth, canvasHeight);
}



function createLevel4() {
    setupLevel();

	// sets up the player
    addPlayer(makeCircle(20, 500, 20));
	
	addStatic(makeRect(0, 550, 400, 800, 0));
	
	addStatic(CircleRamp(180, 550, 140, 140));
	addStatic(CircleRamp(200, 430, 120, 120).rotate(-Math.PI/2));
	addStatic(CircleRamp(80, 360, 120, 120).rotate(Math.PI/2));
	addStatic(CircleRamp(80, 260, 120, 120).rotate(Math.PI));
	
	//addStatic(ParabolaRamp(400, 450, 200, 100));
	
	addStatic(makeRect(200, 200, 600, 260, 0));
	
	// ending platform
    var basex = 620;
    var basey = 450;

    addTrigger(modEndLevel(makeRectX(basex + 10, basey - 10, 80, 10, 3)),endLevel);
	addStatic(makeRectX(basex, basey, 100, 20, 0))
	
	
    // use this to make bounds of the world
    createBounds(canvasWidth, canvasHeight);
}

function createLevel4_1() {
    setupLevel();

	addHint("Is boost alone enough???", 150, 150);

	// sets up the player
    addPlayer(makeCircle(20, 500, 20));
	
	addStatic(makeRect(0, 550, 400, 800, 0));

    // ending platform
    addTrigger(modEndLevel(makeRectX(590, 320, 80, 10, 3)),endLevel);
	addStatic(makeRectX(580, 330, 100, 20, 0));
	
    addStatic(ParabolaRamp(200, 550, 200, 80));

    // use this to make bounds of the world
    createBounds(canvasWidth, canvasHeight);
}

function createLevel5() {
    setupLevel();

	// sets up the player
    addPlayer(makeCircle(20, 500, 20));
	
	addStatic(makeRect(0, 550, 320, 800, 0));
	addStatic(makeRect(480, 550, 920, 800, 0));
	
	addStatic(CircleRamp(180, 550, 140, 140));
	addStatic(CircleRamp(200, 430, 120, 120).rotate(-Math.PI/2));
	addStatic(CircleRamp(80, 360, 120, 120).rotate(Math.PI/2));
	addStatic(CircleRamp(80, 260, 120, 120).rotate(Math.PI));
	
	addStatic(CircleRamp(480, 550, 140, 140).rotate(Math.PI/2));
	addStatic(CircleRamp(480, 430, 120, 120).rotate(Math.PI));
	addStatic(CircleRamp(600, 360, 120, 120));
	addStatic(CircleRamp(520, 260, 200, 200).rotate(-Math.PI/2));
	
	addStatic(CircleRamp(800, 550, 120, 120));
	
	//addStatic(ParabolaRamp(400, 450, 200, 100));
	
	addStatic(makeRectX(200, 200, 160, 60, 0));
	addStatic(makeRectX(440, 200, 160, 60, 0));
	
	// ending platform
    var basex = 870;
    var basey = 250;

	addStatic(makeRectX(basex, basey, 100, 20, 0));
    basex += 10;
    basey += 20;
    addTrigger(modEndLevel(makeRectX(basex, basey, 80, 10, 3)),endLevel);
	
	
    // use this to make bounds of the world
    createBounds(canvasWidth, canvasHeight);
}

// ramp: xylh
// rect: ltrb
function createLevel6() {
	setupLevel();
	
	// sets up the player
    addPlayer(makeCircle(20, 500, 20));
	
	//bounds
	addStatic(makeRect(-100, -100, 0, canvasHeight + 100));
    addStatic(makeRect(canvasWidth, -100, canvasWidth + 100, canvasHeight + 100));
	
	addStatic(makeRect(0, 550, 350, 800, 0));	
	addStatic(ParabolaRamp(150, 550, 200, 80));
	
	addStatic(makeRect(470, 350, 820, 400, 0));	
	addStatic(ParabolaRamp(620, 350, 200, 80));
	
	addStatic(makeRect(900, 150, 1200, 200, 0));
	
	addStatic(makeRect(950, 450, 1200, 500, 0));	
	addStatic(ParabolaRamp(1000, 450, 200, 80));
	
	addStatic(makeRect(900, 200, 950, 300, 0));
	//addStatic(makeRect(820, 300, 950, 350, 0));
	
	addStatic(makeRect(600, 500, 800, 550, 0));
	
	// ending platform
    var basex = 470;
    var basey = 450;

    addTrigger(modEndLevel(makeRectX(basex + 20, basey + 10, 10, 80, 3)),endLevel);
	addStatic(makeRectX(basex, basey, 20, 100, 0))
	
	
	
	
	
	
	
	// use this to make bounds of the world
    createBounds(canvasWidth, canvasHeight);
	
	
	

}

function modEndLevel(obj){
	obj.glObject.color = [0.6, 0.9, 0.9, 1.0];
	return obj;
}


levels = [ createLevel1, createLevel2, createLevel3, createLevel4, createLevel4_1, createLevel5, createLevel6 ];

//


